package com.atguigu.gulimall.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * <简述>sprigsession的核心原理
 * <详细描述>1- @EnableRedisHttpSession
 *          @Import({RedisHttpSessionConfiguration.class})  给容器添加组件 RedisOperationsSessionRepository ： redis crud的封装类
 *          extends SpringHttpSessionConfiguration ==>Fliter  给容器防止 SessionRepositoryFilter 过滤器 ：  每个请求过来经过 Fliter
 *          1-创建时候自动从容器中获取  RedisOperationsSessionRepository
 *          2-封装原始的 request response 为 SessionRepositoryRequestWrapper SessionRepositoryResponseWrapper
 *              SessionRepositoryFilter<S>.SessionRepositoryRequestWrapper wrappedRequest = new SessionRepositoryFilter.SessionRepositoryRequestWrapper(request, response, this.servletContext);
 *         SessionRepositoryFilter.SessionRepositoryResponseWrapper wrappedResponse = new SessionRepositoryFilter.SessionRepositoryResponseWrapper(wrappedRequest, response);
 *         3-以前获取seesion  request.getSession()
 *         filterChain.doFilter(wrappedRequest, wrappedResponse);
 *         现在是 wrappedRequest.getSession() 就是在 RedisOperationsSessionRepository 中获取
 *
 *         4-自动延期 redis session 有自动延期
 *
 *         装饰者模式
 * @author syf
 * @date 2022/12/27 21:29
 * @param null
 * @return null
 */

@EnableRedisHttpSession //整合reis昨晚session 存储
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = "com.atguigu.gulimall.auth.feign")
public class GulimallAuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallAuthServerApplication.class, args);
    }

}
